import Vue from "vue";
import App from "./App.vue";
import MintUI from 'mint-ui'
import VueImg from 'v-img'
import router from './router/index.js'
import service from './service/index.js'
import Config from './config.js'
import './assets/fontAwesome/css/font-awesome.min.css'
import './assets/css/swiper.min.css';
import './assets/css/common.css'
import 'mint-ui/lib/style.css'
import layer from "layui-layer";
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard);
Vue.use(VueImg)
Vue.use(MintUI)
Vue.prototype.utilHelper = Config;
Vue.prototype.$http = service;
Vue.config.productionTip = false;
Vue.directive('res',{
	inserted:function(el,binding){
		var res = JSON.parse(window.sessionStorage.getItem("2_resources"));
		el.style.display = 'none';
		if(res && res.length >0){
			for(var i=0;i<res.length;i++){
				if(binding.expression == res[i]){
					el.style.display = 'block';
					break
				}else{
					el.style.display = 'none';
				}
			}
		}
	}
});
Vue.directive('title', {
    inserted: function (el, binding) {
        document.title = el.dataset.title
    }
});
Vue.directive('isShow',{//判断用户是否登录，如果没登录就不显示该标签
    inserted:function(el,binding){
        let userId = window.localStorage.getItem("2_userId");
        if(!userId){
            el.style.display='none';
            //	return false;
        }else{
            el.style.visibility='visible';
            //	return true;
        }
    }
});
Vue.directive('login',{//判断用户是否登录，如果没登录就不显示该标签
    inserted:function(el,binding){
        let userId = window.localStorage.getItem("2_userId");
        if(!userId){
            el.style.top = '60px';
            //	return false;
        }else{
            el.style.top = '240px';
            //	return true;
        }
    }
});
new Vue({
  router,
  render: h => h(App)
}).$mount("#app");
